package DesignPrinciple.DepInversion.CorrectDIP;

import DesignPrinciple.DepInversion.CorrectDIP.inter.CPU;
import DesignPrinciple.DepInversion.CorrectDIP.inter.HardDisk;
import DesignPrinciple.DepInversion.CorrectDIP.inter.Memory;
import Utils.Util;

public class Computer {
    private CPU cpu;
    private Memory memory;
    private HardDisk hardDisk;

    public CPU getCpu() {
        return cpu;
    }

    public void setCpu(CPU cpu) {
        this.cpu = cpu;
    }

    public Memory getMemory() {
        return memory;
    }

    public void setMemory(Memory memory) {
        this.memory = memory;
    }

    public HardDisk getHardDisk() {
        return hardDisk;
    }

    public void setHardDisk(HardDisk hardDisk) {
        this.hardDisk = hardDisk;
    }

    public void run() {
        Util.inner(System.out::println, "运行计算机");
        hardDisk.get();
        Util.divide();
        cpu.run();
        Util.divide();
        memory.save();
    }
}
